<?php

use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;

/**
 * Dcat-admin - admin builder based on Laravel.
 * @author jqh <https://github.com/jqhph>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 *
 * extend custom field:
 * Dcat\Admin\Form::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */
//Admin::menu(function (\Dcat\Admin\Layout\Menu $menu) {
//    $menu->add([
//        [
//            'id'        => 1,
//            'title'     => '用户中心',
//            'icon'      => 'feather icon-users',
//            'uri'       => '',
//            'parent_id' => 0,
//        ],
//        [
//            'id'        => 2,
//            'title'     => '用户管理',
//            'icon'      => 'feather icon-user',
//            'uri'       => 'member-user',
//            'parent_id' => 1,
//        ],
//        [
//            'id'        => 3,
//            'title'     => '网站配置',
//            'icon'      => 'feather icon-settings',
//            'uri'       => 'web-config',
//            'parent_id' => 0,
//        ],
//        [
//            'id'        => 4,
//            'title'     => '开放接口文档',
//            'icon'      => 'feather icon-layers',
//            'uri'       => '/openapi-docs',
//            'parent_id' => 0,
//        ]
//    ]);
//});

// 平台客服
//admin_inject_section(Admin::SECTION['BODY_INNER_AFTER'], function () {
//    return view('admin::layouts.kefu');
//});

Dcat\Admin\Color::extend('wechat', [
    'primary'        => '#17b95c',
    'primary-darker' => '#17b95c',
    'link'           => '#17b95c',
]);

Grid::resolving(function (Grid $grid) {
    // 禁止 outline 模式
    $grid->toolsWithOutline(false);
    // 列中操作直接显示 不要默认的三个点
    $grid->setActionClass(\Dcat\Admin\Grid\Displayers\Actions::class);
    // 开启右边的字段显示选择
    $grid->showColumnSelector();
    // 开启导出
//    $grid->export();
    // 列表去掉`查看`
    $grid->showViewButton(false);
    // 开启快速编辑
//    $grid->showQuickEditButton();
    // 禁用默认编辑
//    $grid->disableEditButton();
});

Form::resolving(function (Form $form) {
    // 底部去掉`查看`
    $form->footer(function (Form\Footer $footer) {
        $footer->disableViewCheck();
    });
    // 详情去掉`查看`
    $form->tools(function (Form\Tools $tools) {
        $tools->disableView();
    });
});
